package com.itheima.myIO.homework.homework07;


import java.io.*;

public class Test07 {
    /*
        请使用缓冲流将D盘下的某个音频或者视频文件，拷贝到当前模块目录下，
        并计算拷贝过程消耗的时间，将时间（单位毫秒）打印到控制台。
     */
    public static void main(String[] args) throws IOException {
        long start = System.currentTimeMillis();
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D:\\itcast\\嘿嘿嘿.avi"));
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("day12_file&字节流\\嘿嘿嘿.avi"));
        byte [] bytes = new byte[1024];
        int len;

        while((len = bis.read(bytes))!=-1){
            bos.write(bytes,0,len);
        }

        /*int b;
        while ((b = bis.read()) != -1) {
            bos.write(b);
        }*/

        long end = System.currentTimeMillis();
        System.out.println("共耗时：" + (end - start) + "毫秒");

        bis.close();
        bos.close();
    }
}
